package com.zjh.reactive;

import org.junit.Test;
import reactor.core.publisher.Flux;

/**
 * @Auther: zjh
 * @Date: 2025/11/3 - 11 - 03 - 14:06
 * @Description: com.zjh.reactive
 * @version: 1.0
 */
public class CollectDemo {
    @Test
    public void toList(){
        Flux.range(1,5)
                .collectList()
                .subscribe(System.out::println);
    }
    @Test
    public void toMap(){
        Flux.range(1,5)
                .collectMap(e->"key:"+e)
                .subscribe(System.out::println);

        Flux.just(1,1,2)
                .collectMap(
                        e->"key:"+e,
                        k->"value:"+k)
                .subscribe(System.out::println);

    }
}
